var Utils = {
	trim : function(_str){
		return _str.replace(/(^\s*)|(\s*$)/g,'');
	},
	getUrlParam : function(name){
		
		var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
		var r = window.location.search.substr(1).match(reg);  //匹配目标参数
		if (r!=null) return decodeURI(r[2]); return null; //返回参数值
	},
	addCookie : function(name,value,expiresHours){ 
		
		var cookieString=name+"="+escape(value);
		
		//判断是否设置过期时间 
		if(expiresHours>0){ 
			var date = new Date();
			date.setTime(date.getTime() + expiresHours*3600*1000);
			cookieString=cookieString+"; expires=" + date.toGMTString();
		} 
		document.cookie=cookieString; 
	},
	getCookie : function(name){ 
		
		var strCookie=document.cookie; 
		var arrCookie=strCookie.split("; "); 
		for(var i=0;i<arrCookie.length;i++){ 
			var arr=arrCookie[i].split("="); 
			if(arr[0]==name)return unescape(arr[1]); 
		}
	},
	deleteCookie : function(name){ 
		
		var date=new Date(); 
		date.setTime(date.getTime()-10000); 
		document.cookie=name+"=v; expires="+date.toGMTString(); 
	} 
}

String.prototype.trim=function() {  
    return this.replace(/(^\s*)|(\s*$)/g,'');  
};